package one.stand.controller;

import one.stand.model.OrdersModel;
import one.stand.model.ResultModel;
import one.stand.request.CompanyRoyaltyRequest;
import one.stand.request.CompanyTransferRequest;
import one.stand.request.OrdersRequest;
import one.stand.request.RoyaltyRecordRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 分销管理
 * @author Administrator
 */
@RestController
@RequestMapping("/distribution")
public class DistributionController extends BaseController {

    /**
     * 分销管理-数据统计
     *
     * @param request
     * @return
     */
    @PostMapping("/getRoyaltyData")
    public ResultModel<Map<String, Object>> getRoyaltyData(@RequestBody RoyaltyRecordRequest request) {
        return distributionService.getRoyaltyData(request);
    }

    /**
     * 设置分销金额比例
     *
     * @param request
     * @return
     */
    @PostMapping("/companyRoyalty")
    public ResultModel<Boolean> companyRoyalty(@RequestBody CompanyRoyaltyRequest request) {
        return distributionService.companyRoyalty(request);
    }

    /**
     * 分销订单列表
     *
     * @param request
     * @return
     */
    @PostMapping("/selectRoyaltyOrderList")
    public ResultModel<Map<String, Object>> selectRoyaltyOrderList(@RequestBody OrdersRequest request) {
        return distributionService.selectRoyaltyOrderList(request);
    }

    /**
     * 分销订单详情
     *
     * @param request
     * @return
     */
    @PostMapping("/getRoyaltyOrderInfo")
    public ResultModel<OrdersModel> getRoyaltyOrderInfo(@RequestBody OrdersRequest request) {
        return distributionService.getRoyaltyOrderInfo(request);
    }

    /**
     * 佣金排行列表
     *
     * @param request
     * @return
     */
    @PostMapping("/selectRoyaltyRankList")
    public ResultModel<Map<String, Object>> selectRoyaltyRankList(@RequestBody RoyaltyRecordRequest request) {
        return distributionService.selectRoyaltyRankList(request);
    }

    /**
     * 企业到账记录列表
     *
     * @param request
     * @return
     */
    @PostMapping("/selectCompanyTransferList")
    public ResultModel<Map<String, Object>> selectCompanyTransferList(@RequestBody CompanyTransferRequest request) {
        return distributionService.selectCompanyTransferList(request);
    }

    /**
     * 更改结算状态
     *
     * @param request
     * @return
     */
    @PostMapping("/updateCompanyTransferState")
    public ResultModel<Boolean> updateCompanyTransferState(@RequestBody CompanyTransferRequest request) {
        return distributionService.updateCompanyTransferState(request);
    }
}
